import React from "react";
import "./index.scss";

//const formatCard = value => "*".repeat(4).concat(" ").repeat(3).concat(value);

const Card = ({ item, onClick, payMonery, type }) => (
	<div
		className={
			type == "pay" && payMonery - 0 > item.dayAmount - 0
				? "item disabled"
				: "item"
		}
		onClick={() => onClick(item)}
	>
		<img src={item.logoUrl} alt="" className="item-img" />
		<div className="item-desc">
			<p className="item-name">{item.bankName}</p>
			<p className="item-type">储蓄卡</p>
			<p className="item-card">{item.desensitizationCardNo}</p>

			{type == "pay" && payMonery - 0 > item.dayAmount - 0 && (
				<p className="item-card-error">还款金额不能大于每日单笔限额</p>
			)}
		</div>
	</div>
);

export default Card;
